/*
 * DropShawdowTableCellRenderer.java
 *
 * Created on August 29, 2006, 12:55 AM
 */

package com.thornapple.ebay.manager.ui;

import java.awt.Component;
import javax.swing.JTable;
import javax.swing.UIManager;
import javax.swing.table.TableCellRenderer;
import org.jdesktop.swingx.border.DropShadowBorder;

/**
 *
 * @author  Bill
 */
public class DropShawdowTableCellRenderer extends javax.swing.JPanel
        implements TableCellRenderer{
    
    /** Creates new form DropShawdowTableCellRenderer */
    public DropShawdowTableCellRenderer() {
        initComponents();
    }
    
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
    private void initComponents() {
        dropShadowBorderMiddle = new DropShadowBorder(
            UIManager.getColor("Control"), 1, 5, .5f, 12, false, false, true, false);
        dropShadowBorderEnd =  new DropShadowBorder(
            UIManager.getColor("Control"), 1, 5, .5f, 12, false, false, true, true);
        label = new javax.swing.JLabel();

        label.setText("Label");

        org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(layout.createSequentialGroup()
                .addContainerGap()
                .add(label)
                .addContainerGap(75, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup()
                .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .add(label)
                .addContainerGap())
        );
    }// </editor-fold>//GEN-END:initComponents
    
    
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private org.jdesktop.swingx.border.DropShadowBorder dropShadowBorderEnd;
    private org.jdesktop.swingx.border.DropShadowBorder dropShadowBorderMiddle;
    private javax.swing.JLabel label;
    // End of variables declaration//GEN-END:variables
    
    public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
        
        if (isSelected) {
            if (column < table.getColumnCount()-1) {
                setBorder(dropShadowBorderMiddle);
            }else if (column == table.getColumnCount()-1){
               setBorder(dropShadowBorderEnd); 
            }
        } else
            setBorder(null);
        if (value != null)
            label.setText(value.toString());
        return this;
    }
    
}
